package com.example.test.jump;

import android.util.SparseArray;

import com.example.common.jump.ActivityId;
import com.example.common.jump.ActivityStruct;
import com.example.module.ModuleMainActivity;
import com.example.test.activity.MainActivity;
import com.example.test.activity.MainSecondActivity;
import com.example.test.activity.MainThirdActivity;

/**
 * 用来储存所有的Activity实例
 */


public class ActivityMapping {
	private static final ActivityMapping INSTANCE = new ActivityMapping();
	private SparseArray<ActivityStruct> sparseArray = new SparseArray<>();

	public static ActivityMapping getinstance() {
		return ActivityMapping.INSTANCE;
	}


	private ActivityMapping() {
		sparseArray.put(ActivityId.APP_MAIN, new ActivityStruct("app主页面", MainActivity.class));
		sparseArray.put(ActivityId.APP_SECOND, new ActivityStruct("app二级页面", MainSecondActivity.class));
		sparseArray.put(ActivityId.APP_THIRD, new ActivityStruct("app三级页面", MainThirdActivity.class));


		//用来储存module包中的页面
		sparseArray.put(ActivityId.MODULE_MAIN, new ActivityStruct("module主页面", ModuleMainActivity.class));
	}

	public ActivityStruct getActivityStruct(int activityId) {
		if (null == sparseArray) {
			sparseArray = new SparseArray<>();
		}
		return sparseArray.get(activityId, new ActivityStruct("主页面", MainActivity.class));
	}

}
